﻿<%@ Page Title="Quản lý người dùng" Language="C#" MasterPageFile="~/Admins/MasterAdmin.master" AutoEventWireup="true" CodeFile="Users.aspx.cs" Inherits="Admins_Users" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderChangeAdmin" runat="Server">
    <ext:Toolbar runat="server" ID="ToolbarMenuUser">
        <Items>
            <ext:Button ID="ToolbarShowAdd" runat="server" Text="Thêm mới" Icon="Add" OnDirectClick="ToolbarShowAdd_DirectClick" />
            <ext:ToolbarSeparator ID="ToolbarSeparator3" runat="server" />
            <ext:Button ID="ToolbarHelp" runat="server" Text="Hỗ trợ" Icon="Help" />
        </Items>
    </ext:Toolbar>
    <ext:Store ID="StoreUsers" runat="server" OnReadData="StoreUsers_ReadData"
        PageSize="10">
        <Model>
            <ext:Model ID="ModelUsers" runat="server" IDProperty="UserID">
                <Fields>
                    <ext:ModelField Name="UserID" />
                    <ext:ModelField Name="Username" />
                    <ext:ModelField Name="FullName" />
                    <ext:ModelField Name="Gender" />
                    <ext:ModelField Name="DateOfBirth" />
                    <ext:ModelField Name="Telephone" />
                    <ext:ModelField Name="Email" />
                    <ext:ModelField Name="IdentityCard" />
                    <ext:ModelField Name="Address" />
                </Fields>
            </ext:Model>
        </Model>
    </ext:Store>
    <ext:GridPanel
        ID="GridPanelUsers"
        runat="server"
        Title="Danh sách người dùng"
        Height="600"
        StoreID="StoreUsers">
        <ColumnModel ID="ColumnModelUsers" runat="server">
            <Columns>
                <ext:Column ID="Col_UserID" runat="server" Text="ID" DataIndex="UserID" />
                <ext:Column ID="Col_UserName" runat="server" Text="Tài khoản" DataIndex="Username" />
                <ext:Column ID="Col_FullName" runat="server" Text="Tên" DataIndex="FullName" Flex="1" />
                <ext:Column ID="Col_Gender" runat="server" Text="Giới tính" DataIndex="Gender" />
                <ext:Column ID="Col_DateOfBirth" runat="server" Text="Ngày sinh" DataIndex="DateOfBirth" />
                <ext:Column ID="Col_Telephone" runat="server" Text="Số điện thoại" DataIndex="Telephone" />
                <ext:Column ID="Col_Email" runat="server" Text="Email" DataIndex="Email" />
                <ext:Column ID="Col_IdentityCard" runat="server" Text="Chứng minh thư" DataIndex="IdentityCard" />
                <ext:Column ID="Col_Address" runat="server" Text="Địa chỉ" DataIndex="Address" />
            </Columns>
        </ColumnModel>
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbarUsers" runat="server" StoreID="StoreUsers" AfterPageText="của {0}"
                BeforePageText="Trang" DisplayMsg="Hiển thị  {0} - {1} của {2}" EmptyMsg="Chưa có dữ liệu"
                FirstText="Trang đầu" LastText="Trang cuối" NextText="Trang tiếp"
                PrevText="Trang trước" RefreshText="Làm mới" />
        </BottomBar>
    </ext:GridPanel>
    <!-- Cửa sổ popup thêm mới người dùng -->
    <ext:Window 
        ID="WindowCreateUsers" 
        runat="server" 
        Title="Thêm mới người dùng"
        Icon="add" 
        Width="500" 
        Height="300" 
        Modal="true" 
        ShadowMode="Frame" 
        Hidden="true"
        Collapsible="true" 
        Resizable="false" 
        BodyStyle="background-color: #fff;">
        <Content>
            <ext:FormPanel runat="server" ID="FormWindowCreateUsers" Unstyled="true" Height="200">
                <Items>
                    <ext:Toolbar ID="ToolbarFunctions" runat="server">
                        <Items>
                            <ext:Button ID="ButtonCreate" runat="server" Text="Lưu lại" Icon="DiskBlack">
                                <Listeners>
                                    <Click Handler="if(#{FormWindowCreateUsers}.getform().isvalid()) {app.direct.Create_Users();}" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="ButtonReset" runat="server" Text="làm mới" Icon="Reload">
                                <Listeners>
                                    <Click Handler="#{FormWindowCreateUsers}.getForm().Reset();" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="ButtonCancel" runat="server" Text="Hủy bỏ" Icon="Stop">
                                <Listeners>
                                    <Click Handler="#{FormWindowCreateUsers}.Close();" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                    <ext:Container ID="ContainerFormInfor" runat="server">
                        <Items>
                            <ext:Container runat="server" ID="container5" MarginSpec="10 0 10 5">
                                <Items>
                                    <ext:TextField ID="TextUsername" runat="server" FieldLabel="Tên tài khoản"
                                        Width="470" BlankText="Tên tài khoản không được để trống"
                                        AllowBlank="false" />
                                    <ext:TextField ID="TextPassword" runat="server" FieldLabel="Mật khẩu"
                                        Width="470" BlankText="Mật khẩu không được để trống"
                                        AllowBlank="false" />
                                    <ext:TextField ID="TextFullname" runat="server" FieldLabel="Tên đầy đủ"
                                        Width="470" BlankText="Tên đầy đủ không được để trống"
                                        AllowBlank="false" />
                                </Items>
                            </ext:Container>
                        </Items>
                    </ext:Container>
                </Items>
            </ext:FormPanel>
        </Content>
    </ext:Window>
</asp:Content>
